#include <stack>

using namespace std;

class MinStack {
private:
    stack<int> data;
    stack<int> min;
public:
    /** initialize your data structure here. */
    MinStack() {}

    void push(int x) {
        data.push(x);
        if (min.size() > 0) {
            if (x < min.top()) {
                min.push(x);
            } else {
                min.push(min.top());
            }
        } else {
            min.push(x);
        }
    }

    void pop() {
        min.pop();
        data.pop();
    }

    int top() {
        return data.top();
    }

    int getMin() {
        return min.top();
    }
};

int main() {
    MinStack minStack;
    minStack.push(-2);
    minStack.push(0);
    minStack.push(-3);
    minStack.getMin();
    minStack.pop();
    minStack.top();
    minStack.getMin();
    return 0;
}

/**
 * Your MinStack object will be instantiated and called as such:
 * MinStack* obj = new MinStack();
 * obj->push(x);
 * obj->pop();
 * int param_3 = obj->top();
 * int param_4 = obj->getMin();
 */